import request from '../../utils/Request'
import PageUtils from "../../utils/PageUtils";


export const listUserByOrgId = bId => {
  return request({
    method: 'get',
    url: '/api/manage/user/list/org/' + bId,
    params: {}
  })
}
export const listUserByRoleId = bId => {
  return request({
    method: 'get',
    url: '/api/manage/user/list/role/' + bId,
    params: {}
  })
}

export const listUser = (data, current, size) => {
  let pageUrl = PageUtils.page(current, size)
  return request({
    method: 'get',
    url: '/api/manage/user/list?' + pageUrl,
    params: data
  })
}

export const saveUser = data => {
  return request({
    method: 'post',
    url: '/api/manage/user/save',
    data: data
  })
}

export const createUser = data => {
  return request({
    method: 'post',
    url: '/api/manage/user/create',
    data: data
  })
}

export const updateUser = data => {
  return request({
    method: 'post',
    url: '/api/manage/user/update',
    data: data
  })
}

export const updateUserStatus = (userId, status) => {
  return request({
    method: 'get',
    url: '/api/manage/user/' + userId + '/status/' + status,
    params: {}
  })
}

export const updateUserPassword = data => {
  return request({
    method: 'post',
    url: '/api/manage/user/update/password',
    data: data
  })
}

export const resetUserPassword = data => {
  return request({
    method: 'post',
    url: '/api/manage/user/reset/password',
    data: data
  })
}

export const deleteUser = bId => {
  return request({
    method: 'get',
    url: '/api/manage/user/delete/' + bId,
    params: {}
  })
}

